let limit = 20;
let skip = 0;
var that;
var app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    list:[]
  },

  nav_guanli(e){
    console.log(e.currentTarget.id)
    if (e.currentTarget.id == 0) {
      wx.redirectTo({
        url: '/pages/administration/shenhe/shenhe',
      })
    }else if (e.currentTarget.id == 1) {
      wx.redirectTo({
        url: '/pages/administration/chat_list/chat_list',
      })
    }else if (e.currentTarget.id == 2) {
      wx.redirectTo({
        url: '/pages/administration/invitation_list/invitation_list',
      })
    }
  },
  zhuangtai(status){
    if(status==1){
      return '已同意'
    }else if(status ==2){
      return '已拒绝'
    }else{
      return '待确认'
    }
  },
  onLoad() {
    that =this
    app.DB.collection('invitation_list')
      .where({})
      .skip(skip)
      .limit(limit)
      .get()
      .then(res => {
        console.log('getInvitation_list-res', res)
        res.data.forEach(item=>{
          item.status = this.zhuangtai(item.status)
        })
        that.setData({
          list: [...that.data.list, ...res.data], //合并数据
          isEndOfList: res.data.length < limit ? true : false //判断是否结束
        })
      })
  },

  onReachBottom: function () {
    !that.data.isEndOfList && that.getData()
  },
})